﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;
using System.Web;
using System.Web.Caching;
using System.Net;
namespace Friedlich.Extensions
{
    public static class Linq
    {
        public static Cache _cache;
        public static XDocument Load(string urn, bool ifModified) {
            //XDocument cachedDoc = _cache.Get(urn) as XDocument;
            Uri feedUri = new Uri(urn);
            HttpWebRequest feedRequest = (HttpWebRequest)WebRequest.Create(feedUri);
            XDocument posterousDoc = null;
            if (!ifModified || DateTime.Compare(DateTime.Now, feedRequest.IfModifiedSince) == 0)
            {
                posterousDoc = XDocument.Load(urn);

            }
            return posterousDoc;
        
        }
    }
}
